import java.util.Scanner;

class Person{
	private String name;
	private boolean gender;
	private int age;
	private int id;


	public Person(){
		System.out.println("This is constructor");
	}
	public Person(String name,int age,boolean gender){
		this.name=name;
		this.age=age;
		this.gender=gender;
	}
	public String toString() {
		return "Person [name=" + name + ", age=" + age + ", gender=" + gender + ", id=" + id + "]";
	}
	static int num;
	{
		this.id=num++;
		System.out.println("This is initialization block, id is "+this.id);
		
	}
	static
	  {
	  	System.out.println("This is static initialization block");
	  }
	public void printall()
	{
		System.out.println(this.name+','+this.age+','+this.gender+','+this.id);
	}

}
public class two {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Person[] p = new Person[n];
		for (int i = 0; i < n; i++) {
			p[i] = new Person(sc.next(),sc.nextInt(),sc.nextBoolean());
		}
		for (int i = n-1; i >= 0; i--) {
			System.out.println(p[i].toString());
		}
		  Person p1=new Person();
		  p1.printall();
		  System.out.println(p1);

	}

}
